package net.oschina.foodon.examples.spring.cloud.service.consumer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
 * Created by foodon on 2017/4/9.
 */
@Component
public class RestTemplateFactory {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * 通过@LoadBalanced注解开启均衡负载能力
     *
     * @return restTemplate
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
